from sqlalchemy import select

from src.database.exception_mapper import exception_mapper
from src.database.models import Country
from src.database.repositories.base import SQLAlchemyRepo


class CountryRepoImpl(SQLAlchemyRepo):
    @exception_mapper
    async def get_countries(self) -> list[Country]:
        query = select(Country)

        res = await self._session.scalars(query)
        countries: list[Country] = list(res)

        return countries
